<template>
<div class="subheadings">
     重大活动安保事件({{showMore ? '国家级':'省级'}} )
    <el-button type="primary" link @click="typeSwitch">
        {{ showMore ? '省级':'国家级' }} 
    </el-button>
</div> 
<div class="app-main">
  <vue3-seamless-scroll
    :hover="true"
    :hover-stop="true"
    :list="data"
    :step="0.3"
  >
    <div class="list">
      <div
        class="list-item"
        v-for="(item,index) in data"
        :key="index"
      >
          <span class="list-item-index">{{ index + 1 }}</span>
          <p>
            <span :title="item.iaName" class="list-item-title">{{item.iaName}}</span>
            <span class="list-item-date">{{item.iaTime}}</span>
          </p>
      </div>
    </div>
  </vue3-seamless-scroll>
</div>
</template>
<script setup name="Index">
const emit = defineEmits(['typeSwitch']);
const props = defineProps({
  data: {
    required: true,
    type: Array,
    default: []
  }
})
const defData = reactive({
  showMore: true,//展开收起
})
const { showMore } = toRefs(defData)
function typeSwitch() {
  showMore.value = !showMore.value
  emit('typeSwitch', showMore);
}
</script>
<style lang="scss" scoped>
.subheadings{
    width: 450px;
    height: 105px;
    background-size: 100% 100%;
    background-image: url(/src/assets/images/common/bg_little_title.png);
    margin: 0 auto;
    color: #E4F5FF;
    font-size: 22px;
    font-family: Source Han Sans;
    font-weight: 500;
    line-height: 80px;
    text-align: left;
    box-sizing: border-box;
    padding-left: 40px;
    .el-button--primary{
        background: transparent !important;
        border: none !important;
        float: right;
        margin-top: 24px;
        color: #46FFFF !important;
        font-size: 14px;
        cursor: pointer;
        svg{
            width: 14px;
        }
    }
}
.app-main{
  width: 430px;
  height: 185px !important;
  overflow: hidden;
  margin: 20px auto 0;
}
.list {
    width: 430px;
    margin: 0 auto;
    .list-item {
      display: flex;
      justify-content: space-around;
      &-index{
        display: block;
        width: 30px;
        height: 30px;
        background-size: 100% 100%;
        background-image: url('@/assets/images/anbao/bg_scroll_index.png');
        margin: 2px 1px 2px 0;
        color: #46FFFF;
        font-size: 18px;
        line-height: 30px;
        text-align: center;
      }
      p{
        width: 390px;
        height: 35px;
        background-size: 100% 100%;
        background-image: url('@/assets/images/anbao/bg_scroll.png');
        margin: 0 0 15px;
        font-size: 14px;
        color: #fff;
        line-height: 35px;
        box-sizing: border-box;
        padding:0 15px;
        display: flex;
        justify-content: space-between;
      }
      &-title{
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      &-date{
        display: block;
        width: 110px;
        text-align: right;
      }
      
    }
}
</style>